Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I know you declared behaviour outside the box to be undefined (https://twitter.com/krisajenkins/status/726090881611227136) but that just sounded like a challenge 😀
The issue in the old code was that the triangle added to complete the circle doesn't make sense outside the square (logically, it's the ray that goes out to infinity off the side of the screen), this change only adds that triangle if the angle at the mouse pointer is under half a circle. This means that, so long as the bounding box in convex, the extra triangle won't ever get added outside the box (concave bounding boxes won't work when the pointer is in one of the "caves").
Not the most elegant fix to my mind, but I'm pretty new to elm, and the result is what I was going for, please suggest a more elegant fix if you think of one.